package com.dx.as.config.preference;

import android.content.Context;
import android.content.SharedPreferences;

import com.dx.as.JWCache;

/**
 * Created by Jwaoo on 2017/7/20
 */
public class Preferences {

    private static void saveString(String key, String value) {
        SharedPreferences.Editor editor = getSharedPreferences().edit();
        editor.putString(key, value);
        editor.commit();
    }

    private static void saveInteger(String key, int value) {
        SharedPreferences.Editor editor = getSharedPreferences().edit();
        editor.putInt(key, value);
        editor.commit();
    }

    private static String getString(String key) {
        return getSharedPreferences().getString(key, null);
    }

    private static int getInteger(String key){
        return getSharedPreferences().getInt(key,0);
    }

    static SharedPreferences getSharedPreferences() {
        return JWCache.getContext().getSharedPreferences("Demo", Context.MODE_PRIVATE);
    }

}
